package com.dqhl.community.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.dqhl.community.fragment.OrderFinishFragment;
import com.dqhl.community.fragment.OrderUnFinishFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by LIENLIN on 2016/8/31.
 * 订单列表adapter
 */
public class OrderPagerAdapter extends FragmentPagerAdapter{

    private List<Fragment>list;

    public OrderPagerAdapter(FragmentManager fm) {
        super(fm);
        initFragment();
    }

    /**
     * 实例两个fragment
     */
    private void initFragment() {
        list=new ArrayList<>();
        list.add(new OrderUnFinishFragment());
        list.add(new OrderFinishFragment());
    }

    @Override
    public Fragment getItem(int position) {

        return list.get(position);
    }

    @Override
    public int getCount() {
        return list.size();
    }
}
